<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<link href="${base }/static/css/font-awesome.min93e3.css?v=4.4.0"
	rel="stylesheet">
<link href="${base }/static/css/animate.min.css" rel="stylesheet">
<link href="${base }/static/css/style.min862f.css?v=4.1.0"
	rel="stylesheet">
<!-- <link href="css/layui.css" rel="stylesheet"> -->
<link rel="stylesheet" href="${baes }/static/media/css/bootstrap.css" />
<!-- <script src="${base }/static/jquery.metisMenu.js"></script> -->
<script src="${base}/static/index/vendor/jquery/jquery.min.js"></script>
<script src="${base}/static/index/vendor/bootstrap/js/bootstrap.min.js"></script>
<!-- <script type="text/javascript" src="${base }/js/contabs.min.js"></script> -->
<script type="text/javascript" charset="utf-8" src="${base }/static/js/layer/layer.js"></script>
<script type="text/javascript" src="${base }/static/js/jquery-1.8.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	
	$("#submitButton").click(function(){
        
        var sequenceBegin = $("input[name=sequenceBegin]").val();//充值卡号1
        var sequenceEnd   = $("input[name=sequenceEnd]").val();//充值卡号
        var receiveCount  = $("input[name=receiveCount]").val();//卡数量
        var facePrice     = $("input[name=facePrice]").val();//面额
        var receiveName     = $("input[name=receiveName]").val();//领卡人
        var isCheck = true;
        $('.newmer').each(function(){
            if ($(this).val()=='') {
                layer.msg("*为必填字段,不得为空");
                isCheck = false;
            }
        });
        if(sequenceEnd<sequenceBegin){
        	isCheck = false;
        	layer.msg("您输入的卡号区间有误!");
        }
        if((sequenceEnd-sequenceBegin+1)!=receiveCount){
        	isCheck = false;
        	layer.msg("您输入的卡号数量有误!");
        }
        if($.isNumeric(facePrice)==false){
            layer.msg("请输入正确的面额");
            return false;
        }
        if(isCheck==true){
        	$.ajax({
                url:"${pageContext.request.contextPath}/admin/gasCardBySequence",
                type:'post',
                dataType:'json',
                data:{'sequenceBegin':sequenceBegin,'sequenceEnd':sequenceEnd,
                	'receiveCount':receiveCount,'facePrice':facePrice,
                	'receiveName':receiveName},
                success:function(res)
                {
                    if(res ==1){
                        layer.msg("添加成功", {icon: 1});
                    }else{
                        layer.msg("添加失败", {icon: 5});
                    }
                    //页面跳转
                    location.href="${base}/admin/receiveAll";
                    
                    $("#submitButton").show();
                    $("#submitShow").hide();
                    $("#orderlist_form")[0].reset();
                    
                }
            });
            return false;
        }
        
    });
});
</script>

</head>
<body style="font-size:11px;">
	<div class="portlet-body">
		<form class="dataform" id="orderlist_form">
			<div class="row">
				<label style="margin-left:3%; width:5%;height: 30px;text-align: right;display: inline-block;">充值卡<b style="color: red;font-size: 16px;">*</b>：</label>
				<div style="width:14%;height: 30px;display: inline-block;">
					<input type="text" class="form-control newmer" name="sequenceBegin"
						placeholder="请输入充值卡开始的卡号" value="">
				</div>--
				<div style="width:14%;height: 30px;display: inline-block;">
					<input type="text" class="form-control newmer" name="sequenceEnd"
						placeholder="请输入充值卡结束的卡号" value="">
				</div>
			</div>
			<div class="row">
				<label style="margin-left:3%; width:5%;height: 30px;text-align: right;display: inline-block;">面额<b style="color: red;font-size: 16px;">*</b>：</label>
				<div style="width:14%;height: 30px;display: inline-block;">
					<input type="text" class="form-control newmer" name="facePrice"
						placeholder="充值卡的面额" value="">
				</div>
			</div>
			<div class="row">
				<label style="margin-left:3%; width:5%;height: 30px;text-align: right;display: inline-block;">数量<b style="color: red;font-size: 16px;">*</b>：</label>
				<div style="width:14%;height: 30px;display: inline-block;">
					<input type="text" class="form-control newmer" name="receiveCount"
						placeholder="数量" value="">
				</div>
			</div>
			<div class="row">
				<label style="margin-left:3%; width:5%;height: 30px;text-align: right;display: inline-block;">领取人<b style="color: red;font-size: 16px;">*</b>：</label>
				<div style="width:14%;height: 30px;display: inline-block;">
					<input type="text" class="form-control newmer" name="receiveName"
						placeholder="请输入领取人的名字" value="">
				</div>
			</div>
			<div class="row">
				<div style="width:14%;height: 30px;display: inline-block;margin-left:8%;">
					<input type="button" class="btn offline_serch_hide"
						style="margin-right: 30px; background: #18BC9C; color: #fff; border-color: #18BC9C;"
						value="点击领用" id="submitButton">
				</div>
			</div>
			<div style="width: 100%; height: 15px;"></div>
		</form>
	</div>
</body>
</html>
